<?php
require_once('../../libraryfiles/config.php');
$include = '
<link rel="stylesheet" href="'.W_ROOT.'/css/admin_style.css" />
<script type="text/javascript" src="'.W_ROOT.'/js/action.js"></script>
<script type="text/javascript" src="'.W_ROOT.'/js/common.js"></script>

<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
';
$view = (isset($_GET['view'])) ? $_GET['view'] : '';
switch($view){
	case'add':
		if(isset($_GET['id'])){
			$id=(int)$_GET['id'];   
		   }
		   else if(isset($_POST['id'])){
			$id=$_POST['id'][0];
		   }
		   else $id = 0;
		   
		$site_title = "Administrator Site - Add New User";
		$content = 'add.php';
		break;
        case 'views':
            $site_title = "Administrator Site - View User";
            $content = 'user_detail_view.php';
            break;
	
	case 'publish' :
	if (isset($_GET['id']) && (int)$_GET['id'] > 0) {
		$id = (int)$_GET['id'];
	} else {
		header('Location:'.base_url_admin.'/user/index.php');
		exit();
	}
	
	if(isset($_GET['publish']) && (int)$_GET['publish']>=0 && (int)$_GET['publish']<=1){
		$publish = (int)$_GET['publish'];

	}
	 else {
		header('Location:'.base_url_admin.'/user/index.php');
		exit();
	}
	
	//Statement to publish/unpublish User
	publish('tbluser',$publish,$id);
	
	header("Location:".base_url_admin."/user/index.php?".getAllGetParams(array('view','id','publish')));//page=".$page."&");
	exit();
	break;
	
	case 'unpublish' :
	mysql_query("UPDATE tbluser SET status=0 WHERE id=".$_GET['id']);
					  
					  echo '<p style="color:#FF0000" align="center">User have been blocked!<a href="#" onClick="history.go(-1)">Back</a></p>';
	case 'userprofile':
		$content = 'users_profile.php';
		break;
	case 'changepassword':
		$content = 'changepassword.php';
		break;
	default:
	$site_title = "Administrator Site - User";
	$content = 'list.php';
	break;
}

require_once TMP_ADMIN_PATH;
?>